package clsLib;

import  java.util.ArrayList;

public class GoodsStore {

     private ArrayList<Goods> goodsList ;

    public GoodsStore() {
        
        goodsList=new ArrayList<Goods>();
        
        goodsList.add(new Goods("Apple", 3.5,"This's  Apple."));
        goodsList.add(new Goods("fish", 4,"This's fish."));
        goodsList.add(new Goods("book", 10,"This's book."));
        goodsList.add(new Goods("bag", 20,"This's bag."));
        goodsList.add(new Goods("fruit", 6.7,"This's fruit."));
        goodsList.add(new Goods("pen", 1.2,"This's pen."));
    }  
       

    public ArrayList<Goods> getGoodsList() {
        return goodsList;
    }
    
    public Goods getGoods(String name){
         for (Goods i:getGoodsList()){             
           if(i.getName().equals(name))
               return i;       
        }
       return null;        
    }
    
}
